package com.gitee.wsl.mathematics.function.active

import kotlin.math.exp
import kotlin.math.pow

/**
 * @param
 * @DATA
 * @Author LiDaPeng
 * @Description
 */
class TanHX : ActiveFunction {
    override fun function(x: Float): Float {
        var x = x
        x *= 0.038f
        val x1 = exp(x)
        val x2 = exp(-x)
        val son = x1 - x2 // ArithUtil.sub(x1, x2);
        val mother = x1 + x2 // ArithUtil.add(x1, x2);
        return son / mother //ArithUtil.div(son, mother);
    }

    override fun functionG(out: Float): Float {
        return 1 - out.pow(2.0f)
    }
}
